package com.sphd.emanu.activity.login;

import android.util.Log;

import com.sphd.emanu.mvp.BasePresenterImpl;
import com.sphd.emanu.pojo.login.User;
import com.sphd.emanu.utils.GsonUtil;
import com.wzutils.L;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

/**
 * MVPPlugin
 * 邮箱 784787081@qq.com
 */

public class LoginPresenter extends BasePresenterImpl<LoginContract.View> implements LoginContract.Presenter {

    @Override
    public void setLogin(String s, String s1,String token) {
        Log.e("222===",s+"////"+s1);
        //deviceType 1是ios,2是安卓
        Call<String> call13 = emanuService.login(s,s1,2,token);
        call13.enqueue(new Callback<String>() {
            @Override
            public void onResponse(Call<String> call, Response<String> response) {
                L.e(response.toString());
                User userEntity =GsonUtil.GsonToBean(response.body().toString(),User.class);
                mView.setUserBack(userEntity);
            }

            @Override
            public void onFailure(Call<String> call, Throwable t) {
                Error(t);
            }
        });
    }


}
